var t = require("../../@babel/runtime/helpers/interopRequireDefault")(require("../../http/carApi")), o = getApp(), e = new t.default();

Component({
    properties: {
        products: {
            type: Array
        },
        quantity: {
            type: Number,
            value: 1
        },
        couponHistoryId: {
            type: String
        }
    },
    data: {
        show: !1,
        safeAreaHeight: 0,
        list: []
    },
    attached: function() {
        this.setData({
            safeAreaHeight: o.global.systemInfo.safeAreaHeight
        });
    },
    methods: {
        onClose: function() {
            this.setData({
                show: !1
            });
        },
        showPopup: function() {
            this.setData({
                show: !0
            }), this.getCouponList();
        },
        getCouponList: function() {
            var t = this;
            wx.showLoading({
                title: "加载中",
                mask: !0
            }), e.carTicket({
                products: this.data.products
            }).then(function(o) {
                t.setData({
                    list: o.data.canUseCouponList
                }), wx.hideLoading();
            }).catch(function(t) {
                wx.hideLoading();
            });
        },
        tapping: function(t) {
            var o = "";
            t.detail.coupon && (o = t.detail.coupon.couponHistoryId), this.triggerEvent("sendCouponHistoryId", {
                couponHistoryId: o
            }), this.onClose();
        },
        noUse: function() {
            this.triggerEvent("sendCouponHistoryId", {
                couponHistoryId: ""
            }), this.onClose();
        }
    }
});